home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_dos.lha / dos / sphsrc / sph_modx.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-26  |  1.4 KB  |  66 lines

  1. #include "HEADERS.h"
  2. #include "sphigslocal.h"
  3.       
  4. /* A pointer to double is actually a pointer to
  5.  *  to the first element of a 4by4 matrix.
  6.  */
  7.  
  8. void SPH_scale (scaleX, scaleY, scaleZ,  result)
  9. double scaleX, scaleY, scaleZ;
  10. matrix result;
  11. {
  12.    MAT3hvec scalevec;
  13.    
  14.    scalevec[0] = scaleX;
  15.    scalevec[1] = scaleY;
  16.    scalevec[2] = scaleZ;
  17.    MAT3scale (result, scalevec);
  18. }
  19.  
  20.  
  21. void SPH_translate (translateX, translateY, translateZ,  result)
  22. double translateX, translateY, translateZ;
  23. matrix result;
  24. {
  25.    MAT3hvec translatevec;
  26.    
  27.    translatevec[0] = translateX;
  28.    translatevec[1] = translateY;
  29.    translatevec[2] = translateZ;
  30.    MAT3translate (result, translatevec);
  31. }
  32.  
  33. static MAT3hvec rotaxisvec = {0.0, 0.0, 0.0};
  34. static double degtoradfactor = 0.01745329252;
  35.    
  36. void SPH_rotateX (double angle,  matrix result)
  37. {
  38.    rotaxisvec[0] = 1;
  39.    MAT3rotate (result, rotaxisvec, angle*degtoradfactor);
  40.    rotaxisvec[0] = 0;
  41. }
  42.  
  43. void SPH_rotateY (double angle,  matrix result)
  44. {
  45.    static MAT3hvec rotaxisvec = {0.0, 0.0, 0.0};
  46.    
  47.    rotaxisvec[1] = 1;
  48.    MAT3rotate (result, rotaxisvec, angle*degtoradfactor);
  49.    rotaxisvec[1] = 0;
  50. }
  51.  
  52. void SPH_rotateZ (double angle,  matrix result)
  53. {
  54.    static MAT3hvec rotaxisvec = {0.0, 0.0, 0.0};
  55.    
  56.    rotaxisvec[2] = 1;
  57.    MAT3rotate (result, rotaxisvec, angle*degtoradfactor);
  58.    rotaxisvec[2] = 0;
  59. }
  60.  
  61.  
  62. void SPH_compose (matrix mat1, matrix mat2,  matrix result)
  63. {
  64.    MAT3mult (result, mat1, mat2);
  65. }
  66.